home *** CD-ROM | disk | FTP | other *** search
- /* Display an ASL screenmode requester */
- /* modified for use with jpegAGA 2.x */
-
- #include <exec/types.h>
- #include <libraries/asl.h>
- #include <utility/tagitem.h>
-
- #define __NOLIBBASE__
- #include <proto/exec.h>
- #include <proto/asl.h>
- #include <proto/graphics.h>
-
-
- extern ULONG SMR_DisplayID;
- extern short SMR_HAM;
-
- struct Library *AslBase=NULL;
- extern struct GfxBase *GfxBase;
-
- struct TagItem smrtags[] =
- { { ASLSM_PropertyFlags, DIPF_IS_AA},
- { ASLSM_PropertyMask, DIPF_IS_DUALPF | DIPF_IS_EXTRAHALFBRITE},
- { TAG_DONE, 0 }
- };
-
- struct ScreenModeRequester *smr = NULL;
-
- int ChooseScreenMode(int grayscale, char *title)
- {
- int ASL_failure=1;
-
- if(grayscale)
- smrtags[1].ti_Data = DIPF_IS_DUALPF | DIPF_IS_EXTRAHALFBRITE | DIPF_IS_HAM;
- else
- smrtags[1].ti_Data = DIPF_IS_DUALPF | DIPF_IS_EXTRAHALFBRITE;
-
-
- if(!GfxBase)
- {
- if(!(GfxBase = (struct GfxBase *)OpenLibrary((UBYTE *)"graphics.library",39)))
- {
- printf("Could not open graphics.library V39 or higher.\n");
- return 1;
- }
- }
-
- if(!AslBase) AslBase=OpenLibrary("asl.library", 39L);
-
- if(AslBase)
- {
- if(!smr) smr = (struct ScreenModeRequester *)
- AllocAslRequest(ASL_ScreenModeRequest, smrtags);
- if(smr)
- {
- if( AslRequest(smr, 0L) )
- {
- struct DisplayInfo queryinfo;
-
- /* printf("Display type: $%lx\n", smr->sm_DisplayID); */
- SMR_DisplayID = smr->sm_DisplayID;
- if(GetDisplayInfoData(NULL, (UBYTE *)&queryinfo, sizeof(queryinfo),DTAG_DISP,SMR_DisplayID))
- {
- if(queryinfo.PropertyFlags)
- {
- if(queryinfo.PropertyFlags & DIPF_IS_HAM)
- SMR_HAM = 1;
- else SMR_HAM = 0;
-
- /* if(SMR_HAM) printf("Mode is HAM\n"); */
- }
- else ASL_failure = 1;
- }
-
- ASL_failure=0;
-
- }
- else
- {
- /* printf("User cancelled or error...\n"); */
- ASL_failure=1;
- }
- }
- return ASL_failure;
- }
- printf("Could not open asl.library V39 or higher.\n");
- return 1;
- }
-